import { ApiProperty } from "@nestjs/swagger";
import { IsNotEmpty } from "class-validator";

enum Role {
  ROOT = "root",
  ADMIN = "admin",
  VISITOR = "visitor"
};

export class CreateUserDto {
  @IsNotEmpty({ message: "用户名不能为空",  })
  @ApiProperty({ description: "用户名" })
  readonly username: string;

  @ApiProperty({ description: "密码", required: false, default: "好用户"})
  readonly nickname: string;

  @IsNotEmpty({ message: "密码不能为空",  })
  @ApiProperty({ description: "密码" })
  readonly password: string;

  @ApiProperty({ description: "头像", required: false, default: "" })
  readonly avatar: string;

  @IsNotEmpty({ message: "角色不能为空",  })
  @ApiProperty({ enum: Role, enumName: 'RoleEnum', description: "角色", default: "visitor"})
  readonly role: Role;

  @ApiProperty({ description: "邮箱", required: false, default: "" })
  readonly email: string;
}
